<html>
	<head>
		<title>Validation Library Tester</title>
		<script language="Javascript" src="FormValidator.js"></script>
        <script language="Javascript" src="ValidationItem-Common.js"></script>        
		<script language="Javascript">
			function validateForm() {
				// Create instance of the form validator
				var validator = new FormValidator();
				validator.setErrorIntroText("Please correct the following:\n\n");
		
				// Add items for the validator
				validator.addValidationItem(new ValidationItemEmpty("fldNotEmpty", "validField", "invalidField", "ValidationItemEmpty cannot be empty"));
                validator.addValidationItem(new ValidationItemEmailAddress("fldEmailAddress", "validField", "invalidField", "validationItemEmailAddress is not an e-mail address"));

				// Validate the form
				return validator.validate();
			}
		</script>
		<style>
			.invalidField {
				background: red;
				color: white;
			}

			.validField {
				background: white;
				color: black;
			}
		</style>
	</head>
	<body>
		<h1>Validation Library Tester</h1>
		<form onsubmit="return validateForm()">
		<table>
			<tr>
				<th>Criteria</th>
				<th>User Input</th>
			</tr>
			<tr>
				<td>ValidationItemEmpty:</td>
				<td><input type="text" name="fldNotEmpty" id="fldNotEmpty" value="" /></td>
			</tr>
            <tr>
                <td>ValidationItemEmailAddress:</td>
                <td><input type="text" name="fldEmailAddress" id="fldEmailAddress" value="" /></td>
            </tr>
        	<tr>
				<td>&nbsp;</td>
				<td><input type="submit" value="Validate" /></td>
			</tr>
		</table>
		</form>
	</body>
</html>